package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 模型训练记录表
 * @TableName model_training_record
 */
@TableName(value ="model_training_record")
@Data
public class ModelTrainingRecord implements Serializable {
    /**
     * 训练ID
     */
    @TableId(type = IdType.AUTO)
    private Long trainingId;

    /**
     * 模型ID
     */
    private Long modelId;

    /**
     * 训练数据集
     */
    private String trainingDataset;

    /**
     * 训练开始时间
     */
    private Date trainingStartTime;

    /**
     * 训练结束时间
     */
    private Date trainingEndTime;

    /**
     * 训练准确率
     */
    private BigDecimal trainingAccuracy;

    /**
     * 验证准确率
     */
    private BigDecimal validationAccuracy;

    /**
     * 训练参数
     */
    private String trainingParameters;

    /**
     * 状态：1-训练中，2-已完成，3-失败
     */
    private Integer status;

    /**
     * 创建时间
     */
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ModelTrainingRecord other = (ModelTrainingRecord) that;
        return (this.getTrainingId() == null ? other.getTrainingId() == null : this.getTrainingId().equals(other.getTrainingId()))
            && (this.getModelId() == null ? other.getModelId() == null : this.getModelId().equals(other.getModelId()))
            && (this.getTrainingDataset() == null ? other.getTrainingDataset() == null : this.getTrainingDataset().equals(other.getTrainingDataset()))
            && (this.getTrainingStartTime() == null ? other.getTrainingStartTime() == null : this.getTrainingStartTime().equals(other.getTrainingStartTime()))
            && (this.getTrainingEndTime() == null ? other.getTrainingEndTime() == null : this.getTrainingEndTime().equals(other.getTrainingEndTime()))
            && (this.getTrainingAccuracy() == null ? other.getTrainingAccuracy() == null : this.getTrainingAccuracy().equals(other.getTrainingAccuracy()))
            && (this.getValidationAccuracy() == null ? other.getValidationAccuracy() == null : this.getValidationAccuracy().equals(other.getValidationAccuracy()))
            && (this.getTrainingParameters() == null ? other.getTrainingParameters() == null : this.getTrainingParameters().equals(other.getTrainingParameters()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getTrainingId() == null) ? 0 : getTrainingId().hashCode());
        result = prime * result + ((getModelId() == null) ? 0 : getModelId().hashCode());
        result = prime * result + ((getTrainingDataset() == null) ? 0 : getTrainingDataset().hashCode());
        result = prime * result + ((getTrainingStartTime() == null) ? 0 : getTrainingStartTime().hashCode());
        result = prime * result + ((getTrainingEndTime() == null) ? 0 : getTrainingEndTime().hashCode());
        result = prime * result + ((getTrainingAccuracy() == null) ? 0 : getTrainingAccuracy().hashCode());
        result = prime * result + ((getValidationAccuracy() == null) ? 0 : getValidationAccuracy().hashCode());
        result = prime * result + ((getTrainingParameters() == null) ? 0 : getTrainingParameters().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", trainingId=").append(trainingId);
        sb.append(", modelId=").append(modelId);
        sb.append(", trainingDataset=").append(trainingDataset);
        sb.append(", trainingStartTime=").append(trainingStartTime);
        sb.append(", trainingEndTime=").append(trainingEndTime);
        sb.append(", trainingAccuracy=").append(trainingAccuracy);
        sb.append(", validationAccuracy=").append(validationAccuracy);
        sb.append(", trainingParameters=").append(trainingParameters);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}